/*    */ package com.zimbra.cs.html;
/*    */ 
/*    */ import com.zimbra.common.util.ByteUtil;
/*    */ import java.io.File;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.io.PrintStream;
/*    */ import java.io.Reader;
/*    */ import java.io.Writer;
/*    */ import org.apache.xerces.xni.parser.XMLDocumentFilter;
/*    */ import org.apache.xerces.xni.parser.XMLInputSource;
/*    */ import org.apache.xerces.xni.parser.XMLParserConfiguration;
/*    */ import org.cyberneko.html.HTMLConfiguration;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class HtmlDefang
/*    */   extends AbstractDefang
/*    */ {
/*    */   public void defang(Reader htmlReader, boolean neuterImages, Writer out)
/*    */     throws IOException
/*    */   {
/* 45 */     XMLInputSource source = new XMLInputSource(null, null, null, htmlReader, null);
/* 46 */     defang(source, neuterImages, out);
/*    */   }
/*    */   
/*    */   public void defang(InputStream html, boolean neuterImages, Writer out) throws IOException {
/* 50 */     XMLInputSource source = new XMLInputSource(null, null, null, html, null);
/* 51 */     defang(source, neuterImages, out);
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   protected void defang(XMLInputSource source, boolean neuterImages, Writer out)
/*    */     throws IOException
/*    */   {
/* 66 */     DefangWriter writer = new DefangWriter(out, "utf-8");
/*    */     
/* 68 */     DefangFilter defang = new DefangFilter(neuterImages);
/*    */     
/*    */ 
/* 71 */     XMLDocumentFilter[] filters = { defang, writer };
/*    */     
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/* 77 */     XMLParserConfiguration parser = new HTMLConfiguration();
/* 78 */     parser.setProperty("http://cyberneko.org/html/properties/filters", filters);
/* 79 */     parser.setProperty("http://cyberneko.org/html/properties/names/elems", "match");
/*    */     
/* 81 */     parser.setFeature("http://cyberneko.org/html/features/balance-tags", false);
/* 82 */     parser.setFeature("http://xml.org/sax/features/namespaces", false);
/*    */     
/*    */ 
/* 85 */     parser.parse(source);
/*    */   }
/*    */   
/*    */   public static void main(String[] args) throws IOException {
/* 89 */     String html = new String(ByteUtil.getContent(new File(args[0])));
/* 90 */     HtmlDefang defanger = new HtmlDefang();
/* 91 */     System.out.println(defanger.defang(html, true));
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/html/HtmlDefang.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */